// import Vue from 'vue'
// import Vuex from 'vuex'
import user from './user'

// Vue.use(Vuex)

// const store = new Vuex.Store({
// 	modules:[
// 		user
// 	]
// })

// export default store

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	modules:{
		user
	},
	state: {
		type:1,
		seat:null,
		store: {},
		cart: [],
		orderType: 'takein',
		address: {},
		addresses: {},
		member: {},
		order: {}
	},
	getters: {
		isLogin: state => Object.keys(state.member).length > 0	//是否登录
	},
	mutations: {
		SET_TYPE(state,type){
			state.type=type
		},
		SET_SEAT(state,seat){
			
			state.seat=seat
		},
	
		SET_ORDER_TYPE(state, type) {
			state.orderType = type
		},
		SET_MEMBER(state, member) {
			state.member = member
		},
		SET_ADDRESS(state, address) {
			state.address = address
		},
		SET_ADDRESSES(state, addresses) {
			state.addresses = addresses
		},
		SET_STORE(state, store) {
			state.store = store
		},
		SET_CART(state, cart) {
			state.cart = cart
		},
		REMOVE_CART(state) {
			state.cart = []
		},
		SET_ORDER(state, order) {
			state.order = order
		}
	},
	actions: {
	
	}
})

export default store